package top.itaso.app

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import top.itaso.lib.alog.ALog
import java.lang.Exception

class MainActivity : AppCompatActivity() {
    private val json: String =
        "{\"msg\":\"操作成功\",\"code\":0,\"data\":{\"id\":\"644176904697548800\",\"url\":\"https://cloudvc.tpv-tech.com/adtest/api/common/open/quickfile/644176904697548800?uploadChannel=QUICK\",\"mqtt\":{\"serverAddress\":\"47.96.83.150\",\"port\":1883,\"websocketPort\":null,\"username\":\"quickfile\",\"password\":\"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyTmFtZSI6InF1aWNrZmlsZSIsImlhdCI6MTYzMDkyMDk4M30.3r9BpD4FQGyJfgOPIOFL2FEmVWaLTVTqMFzXjm9fbcfhjZL_3RmXf2hTkf5YkcmTa0t-ettkf1AuWVagG4XrKw\",\"topic\":\"iwbshare/quickfile/644176904697548800\"}}}\n"
    private val xml: String =
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><SyncML><SyncHdr><VerDTD>1.2</VerDTD><VerProto>DM/1.2</VerProto><SessionID>6d02622e55894bc78f8847a467dd1825</SessionID><MsgID><![CDATA[1]]></MsgID><Target><LocURI><![CDATA[http://ota.cn.nettvservices.com/TPVDMServer/update]]></LocURI></Target><Source><LocURI><![CDATA[DC:62:94:02:3B:3B]]></LocURI></Source><Cred><Data><![CDATA[Y2FsbHVwR01UOmNhbGx1cEdNVA==]]></Data><Meta><Type xmlns='syncml:metinf'><![CDATA[syncml:auth-basic]]></Type><Format xmlns='syncml:metinf'><![CDATA[b64]]></Format></Meta></Cred><Meta><MaxMsgSize xmlns='syncml:metinf'><![CDATA[8192]]></MaxMsgSize><MaxObjSize xmlns='syncml:metinf'><![CDATA[8192]]></MaxObjSize></Meta></SyncHdr><SyncBody><Alert><CmdID><![CDATA[1]]></CmdID><Data><![CDATA[1201]]></Data></Alert><Replace><CmdID><![CDATA[2]]></CmdID><Item><Source><LocURI><![CDATA[./DevInfo/Mod]]></LocURI></Source><Meta><Format xmlns='syncml:metinf'><![CDATA[chr]]></Format></Meta><Data><![CDATA[65T32Z]]></Data></Item><Item><Source><LocURI><![CDATA[./DevInfo/Man]]></LocURI></Source><Meta><Format xmlns='syncml:metinf'><![CDATA[chr]]></Format></Meta><Data><![CDATA[AOC]]></Data></Item><Item><Source><LocURI><![CDATA[./DevInfo/Lang]]></LocURI></Source><Meta><Format xmlns='syncml:metinf'><![CDATA[chr]]></Format></Meta><Data><![CDATA[]]></Data></Item><Item><Source><LocURI><![CDATA[./DevInfo/DmV]]></LocURI></Source><Meta><Format xmlns='syncml:metinf'><![CDATA[chr]]></Format></Meta><Data><![CDATA[1.2]]></Data></Item><Item><Source><LocURI><![CDATA[./DevInfo/DevId]]></LocURI></Source><Meta><Format xmlns='syncml:metinf'><![CDATA[chr]]></Format></Meta><Data><![CDATA[DC:62:94:02:3B:3B]]></Data></Item></Replace><Alert><CmdID><![CDATA[3]]></CmdID><Item><Meta><Type xmlns='syncml:metinf'><![CDATA[org.openmobilealliance.dm.firmwareupdate.userrequest]]></Type><Format xmlns='syncml:metinf'><![CDATA[int]]></Format></Meta><Data><![CDATA[0]]></Data></Item><Data><![CDATA[1226]]></Data></Alert><Final /></SyncBody></SyncML>"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        findViewById<Button>(R.id.btn_debug).setOnClickListener {
            ALog.d("savedInstanceState:${savedInstanceState}")
            ALog.dTag("itaso", "savedInstanceState:%s", savedInstanceState)
            ALog.json(json)
            ALog.xml(xml)
        }
        findViewById<Button>(R.id.btn_debug2).setOnClickListener {
            var sss:String? = null;
            throw Exception("发生崩溃了")
        }
    }
}